<?php
/**
 * Created by PhpStorm.
 * User: jksen
 * Date: 2018/1/19
 * Time: 下午3:25
 */

namespace app\api\service;

use app\api\controller\Fun;
use app\common\model\FuncClass as Func;

class FuncClass
{
    /**
     * @param array $where
     * 返回所有的捎货功能和方法
     */
    public static function getAllFunc($where = [])
    {
        $where = array_merge(['status' => Func::STATUS_NORMAL], $where);

        $field = 'func_name,modules';

        //返回所有的业务功能 捎货，帮买 帮送
        $funcs = Func::getAllFunc($where,$field);

        if(!empty($funcs)){
            foreach ($funcs as $key => $val){
                $funcs[$key]['widget'] = \app\api\service\Widget::getWidgetInfoByIds(implode(',',json_decode($val['modules'])));
            }
           return $funcs;
        }
        return;
    }
}